Leicester City put their Premier League woes to one side to beat Derby County 3-1 after extra time in their FA Cup replay and book their place in round five.